Xbasic

*HTML_TO_RTF Function

Syntax

RTF_Text as C = *HTML_TO_RTF(C text)

Arguments

RTF_Text

Encoded ASCII RTF text.

text

Encoded HTML text.

Description

Convert from html to rtf.

Discussion

The *HTML_TO_RTF() function converts HTML text to its equivalent encoded RTF ASCII representation.

Example

dim html_text as C
dim rtf_text as C
html_text = file.to_string("c:\rtf_test.htm")
html_text = extract_string(html_text, "<body", "</body>")
html_text = right(html_text, len(html_text)-1)
? html_text
=
<font face="Verdana, Arial, Helvetica, sans-serif"> <strong> <font color="#FF0000">George</font> </strong> 
lived on top of a mountain.
rtf_text = *html_to_rtf(html_text)
? rtf_text
= "{\rtf1\ansi \deff0{\colortbl;\red0\green0\blue0;}{\fonttbl{\f0\fswiss Arial;}{\f1\fnil Verdana, Arial, Helvetica, sans;}}{{\f1 \cf1 \fs24 George lived on top of a mountain. }}}"

See Also